LinearLayoutCompat

A Layout that arranges its children in a single column or a single row. The direction of the row can be set by calling setOrientation(). You can also specify gravity, which specifies the alignment of all the child elements by calling setGravity() or specify that specific children grow to fill up any remaining space in the layout by setting the weight member of LinearLayoutCompat.LayoutParams. The default orientation is horizontal.

See the Linear Layout guide.

Also see LinearLayoutCompat.LayoutParams for layout attributes

Inheritors

Constructors

Link copied to clipboard
constructor(@NonNull context: @NonNull Context)
constructor(@NonNull context: @NonNull Context, @Nullable attrs: @Nullable AttributeSet)
constructor(@NonNull context: @NonNull Context, @Nullable attrs: @Nullable AttributeSet, defStyleAttr: Int)

Types

Link copied to clipboard
Link copied to clipboard
Per-child layout information associated with ViewLinearLayout.
Link copied to clipboard

Properties

Link copied to clipboard
val HORIZONTAL: Int = 0
Link copied to clipboard
Show a divider at the beginning of the group.
Link copied to clipboard
Show a divider at the end of the group.
Link copied to clipboard
Show dividers between each item in the group.
Link copied to clipboard
Don't show any dividers.
Link copied to clipboard
val VERTICAL: Int = 1

Functions

Link copied to clipboard
open fun getBaseline(): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Get the padding size used to inset dividers in pixels
Link copied to clipboard
Get the width of the current divider drawable.
Link copied to clipboard
Returns the current gravity.
Link copied to clipboard
open fun getOrientation(): Int
Returns the current orientation.
Link copied to clipboard
open fun getShowDividers(): Int
Link copied to clipboard
open fun getWeightSum(): Float
Returns the desired weights sum.
Link copied to clipboard
Indicates whether widgets contained within this layout are aligned on their baseline or not.
Link copied to clipboard
When true, all children with a weight will be considered having the minimum size of the largest child.
Link copied to clipboard
open fun setBaselineAligned(baselineAligned: Boolean)
Defines whether widgets contained in this layout are baseline-aligned or not.
Link copied to clipboard
Link copied to clipboard
open fun setDividerDrawable(divider: Drawable)
Set a drawable to be used as a divider between items.
Link copied to clipboard
open fun setDividerPadding(padding: Int)
Set padding displayed on both ends of dividers.
Link copied to clipboard
open fun setGravity(@GravityInt gravity: Int)
Describes how the child views are positioned.
Link copied to clipboard
open fun setHorizontalGravity(horizontalGravity: Int)
Link copied to clipboard
When set to true, all children with a weight will be considered having the minimum size of the largest child.
Link copied to clipboard
open fun setOrientation(orientation: Int)
Should the layout be a column or a row.
Link copied to clipboard
open fun setShowDividers(showDividers: Int)
Set how dividers should be shown between items in this layout
Link copied to clipboard
open fun setVerticalGravity(verticalGravity: Int)
Link copied to clipboard
open fun setWeightSum(weightSum: Float)
Defines the desired weights sum.